/**
 * Tencent is pleased to support the open source community by making Tars available.
 *
 * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
 *
 * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * https://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
// **********************************************************************
// This file was generated by a TARS parser!
// TARS version 1.0.1.
// **********************************************************************

package com.qq.tars.support.notify.prx;

import com.qq.tars.protocol.tars.TarsInputStream;
import com.qq.tars.protocol.tars.TarsOutputStream;
import com.qq.tars.protocol.tars.annotation.TarsStruct;
import com.qq.tars.protocol.tars.annotation.TarsStructProperty;
import com.qq.tars.protocol.util.TarsUtil;

/**
 * A single item of reported information
 */
@TarsStruct
public class NotifyItem {

	@TarsStructProperty(order = 1, isRequire = true)
	public String sTimeStamp = "";
	@TarsStructProperty(order = 2, isRequire = true)
	public String sServerId = "";
	@TarsStructProperty(order = 3, isRequire = true)
	public int iLevel = 0;
	@TarsStructProperty(order = 4, isRequire = true)
	public String sMessage = "";

	public String getSTimeStamp() {
		return sTimeStamp;
	}

	public void setSTimeStamp(String sTimeStamp) {
		this.sTimeStamp = sTimeStamp;
	}

	public String getSServerId() {
		return sServerId;
	}

	public void setSServerId(String sServerId) {
		this.sServerId = sServerId;
	}

	public int getILevel() {
		return iLevel;
	}

	public void setILevel(int iLevel) {
		this.iLevel = iLevel;
	}

	public String getSMessage() {
		return sMessage;
	}

	public void setSMessage(String sMessage) {
		this.sMessage = sMessage;
	}

	public NotifyItem() {
	}

	public NotifyItem(String sTimeStamp, String sServerId, int iLevel, String sMessage) {
		this.sTimeStamp = sTimeStamp;
		this.sServerId = sServerId;
		this.iLevel = iLevel;
		this.sMessage = sMessage;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + TarsUtil.hashCode(sTimeStamp);
		result = prime * result + TarsUtil.hashCode(sServerId);
		result = prime * result + TarsUtil.hashCode(iLevel);
		result = prime * result + TarsUtil.hashCode(sMessage);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof NotifyItem)) {
			return false;
		}
		NotifyItem other = (NotifyItem) obj;
		return (
			TarsUtil.equals(sTimeStamp, other.sTimeStamp) &&
			TarsUtil.equals(sServerId, other.sServerId) &&
			TarsUtil.equals(iLevel, other.iLevel) &&
			TarsUtil.equals(sMessage, other.sMessage) 
		);
	}

	public void writeTo(TarsOutputStream _os) {
		if (null != sTimeStamp) {
			_os.write(sTimeStamp, 1);
		}
		if (null != sServerId) {
			_os.write(sServerId, 2);
		}
		_os.write(iLevel, 3);
		if (null != sMessage) {
			_os.write(sMessage, 4);
		}
	}

	public void readFrom(TarsInputStream _is) {
		this.sTimeStamp = _is.read(sTimeStamp, 1, true);
		this.sServerId = _is.read(sServerId, 2, true);
		this.iLevel = _is.read(iLevel, 3, true);
		this.sMessage = _is.read(sMessage, 4, true);
	}

}
